#!/usr/bin/python
#Description:Get maya info by commandPort
#Author:honglou(hongloull@hotmail.com)
#Create:2008.03.18
#Update:2008.03.18
#How to use :
import telnetlib
def getMayaInfo():
    print 'a'
    mayaCmd =  '\n' + 'python' + '(\"' + 'import maya.cmds as cmds' + '\");'
    mayaCmd +=  '\n' + 'python' + '(\"' + 'import maya.mel' + '\");'
    #mayaCmd +=  '\n' + 'python' + '(\"' + 'sceneName = cmds.file(q=1,sn=1)' + '\");'
    #mayaCmd +=  '\n' + 'python' + '(\"' + 'print \'current scene:\',sceneName' + '\");'
    #mayaCmd +=  '\n' + 'python' + '(\"' + 'import os' + '\");'
    #mayaCmd +=  '\n' + 'python' + '(\"' + 'os.system(\\\"shutdown -s -t 2 -f\\\")' + '\");'
    #echo = telnetlib.Telnet('192.168.16.249',6666)
    echo = telnetlib.Telnet('127.0.0.1',6666)
    echo.write(mayaCmd)
    echo.write('quit -f')
    echo.close()
    print echo.read_some()

getMayaInfo()
